import request from "@/axios/request";
import url from "@/axios/url";
const { adminUrl } = url();
//获取用户列表
export function getUserList(params = {}) {
  return request({
    url: `${adminUrl}user/list`,
    method: "get",
    params,
  });
}
//根据角色获取用户列表
export function getUserListByRoleIdAndFactory(params = {}) {
  return request({
    url: `${adminUrl}user/getUserListByRoleIdAndFactory`,
    method: "get",
    params,
  });
}
//新增用户
export function userCreate(data = {}) {
  return request({
    url: `${adminUrl}user/create`,
    method: "post",
    data,
  });
}
//修改用户信息
export function userEdit(data = {}) {
  return request({
    url: `${adminUrl}user/edit`,
    method: "post",
    data,
  });
}
//批量删除用户
export function userDelete(data = {}) {
  return request({
    url: `${adminUrl}user/delete`,
    method: "post",
    data,
  });
}
//获取用户信息
export function getUserInfo(userId = "") {
  return request({
    url: `${adminUrl}user/${userId}`,
    method: "get",
  });
}
//重置密码
export function resetPwd(data = {}) {
  return request({
    url: `${adminUrl}user/resetPwd`,
    method: "post",
    data,
  });
}
//修改用户状态
export function changeStatus(data = {}) {
  return request({
    url: `${adminUrl}user/changeStatus`,
    method: "post",
    data,
  });
}

// 导入用户
export function importUser (data = {}) {
  return request({
    url: `${adminUrl}user/import`,
    // url: 'http://80.gr553402.m6tfe15g.ceb51d.grapps.cn/auth/user/import',
    method: 'POST',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    }
  })
}

// 下载模板
export const downloadTemplateUrl = 'http://60.209.248.238:8182/file-template/用户导入模板.xlsx'
